<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>${sysName}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${resRoot}/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all" />
	<link rel="stylesheet" href="${resRoot}/layui/admin/admin.css" media="all" />
	<link id="layuicss-layer" rel="stylesheet" href="${resRoot}/layui/css/modules/layer/default/layer.css" media="all">
</head>
<body class="childrenBody" >
	<div class="layui-fluid">   
          <div class="layui-card">
	<div class="layui-form layui-card-header layuiadmin-card-header-auto">
	<div class="layui-form-item">
		<@shiro.hasPermission name="noticeNews:show">
		<div class="layui-inline">
	    <label class="layui-form-label">小区</label>
	    <div class="layui-input-block">
	      <select name="villageId" id="villageId" lay-verify="required"  >
	      </select>
	    </div>
	  </div>
	  
		<div class="layui-inline">
		    <a class="layui-btn search_btn">查询</a>
		</div>
		</@shiro.hasPermission>
		<@shiro.hasPermission name="noticeNews:add">
		<div class="layui-inline">
			<a class="layui-btn linksAdd_btn" style="background-color:#5FB878" href="${base}/sys/noticeNews/input">添加新闻</a>
		</div>
		</@shiro.hasPermission>
	</div>
	</div>
	
	
	<div class="layui-card-body">
	
	
	<div class="layui-form news_list">
	  	<table class="layui-table">
		    <colgroup>
				<col>
				<col>
				<col>
				<col>
				<col>
		    </colgroup>
		    <thead>
				<tr>
					<th style="text-align:left;">序号</th>
					<th>来源</th>
					<th>类型名称</th>
					<th>标题</th>
					<th>内容</th>
					<th>是否置顶</th>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
		    </thead>
		    <tbody>
		    <@shiro.hasPermission name="noticeNews:show">
		    	<#list result.datas as noticeDTO>
		    	<tr>
					<td style="text-align:left;">${(result.pageNumber - 1)*result.pageSize + noticeDTO_index +1}</td>
					<td>${noticeDTO.source}</td>
					<td>${noticeDTO.typeName!}</td>
					<td>${noticeDTO.title!}</td>
					<td title="${noticeDTO.content}"><#if noticeDTO.content?length &gt; 10 >${noticeDTO.content?substring(0,10)}<#else>${noticeDTO.content}</#if></td>
					<td>${dictMap['is_top'][noticeDTO.isTop]}</td>
					<td>${noticeDTO.createTime?datetime}</td>
					<td>
					<@shiro.hasPermission name="noticeNews:edit">
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="${base}/sys/noticeNews/input?id=${noticeDTO.id}"><i class="iconfont icon-edit"></i>修改</a>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="noticeNews:edit">
						<#if noticeDTO.isTop=="0">
						<a class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:void(0);" onclick="isTop(${noticeDTO.id});" ><i class="iconfont"></i>置顶</a>
						<#else>
						<a class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:void(0);" onclick="cacleIsTop(${noticeDTO.id});" ><i class="iconfont"></i>取消置顶</a>
						</#if>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="noticeComment:show">
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="${base}/sys/noticeComment/show?noticeId=${noticeDTO.id}"><i class="iconfont"></i>评论<#if noticeDTO.commontAuditCount ?? && noticeDTO.commontAuditCount &gt; 0>(${noticeDTO.commontAuditCount})</#if></a>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="noticeLike:show">
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="${base}/sys/noticeLike/show?noticeId=${noticeDTO.id}"><i class="iconfont"></i>点赞</a>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="noticeNews:del"> 
		        		<a class="layui-btn layui-btn-danger layui-btn-xs" href="javascript:void(0);" onclick="del(${noticeDTO.id});" ><i class="layui-icon"></i>删除</a>
		        		</@shiro.hasPermission>
		        	</td>
				</tr>
				</#list>
				</@shiro.hasPermission>
			</tbody>
		</table>
	</div>
	<div id="page"></div>
	</div>
	</div>
	<script type="text/javascript" src="${resRoot}/layui/layui.js"></script>
	<script src="${resRoot}/js/jquery.min.js?v=2.1.4"></script>
	<script src="${resRoot}/layui/layui.all.js" charset="utf-8"></script>
	<#assign pageUrl=base + '/sys/noticeNews/show?'>
	<#include "/page/page1.html">
	<script>
	$(".search_btn").click(function(){
		  window.location.href='${base}/sys/noticeNews/show';
	  });
	  		function del(id) {
  			var flag = 0;
  			layer.confirm('确定删除该条数据吗?', function(index){
  				$.ajax({
  					type : "post",
  					url : "${base}/sys/noticeNews/del",
  					data : {
  						id : id
  					},
  					dataType : "json",
  					async : false,
  					success : function(data) {
  						flag  = data.message;
  						if(flag == 1) {
  							layer.msg('删除成功！', {
  							  icon: 1,
  							  time: 2000 //2秒关闭（如果不配置，默认是3秒）
  							}, function(){
  								window.location.reload();
  							});   
  						} else {
  							layer.alert("服务器繁忙，请稍候再试！");
  						}
  					}
  				});
  			});
  		}
	  		function isTop(id) {
	  			var flag = 0;
	  			layer.confirm('确定置顶该条数据吗?', function(index){
	  				$.ajax({
	  					type : "post",
	  					url : "${base}/sys/noticeNews/isTop",
	  					data : {
	  						id : id
	  					},
	  					dataType : "json",
	  					async : false,
	  					success : function(data) {
	  						flag  = data.message;
	  						if(flag == 1) {
	  							layer.msg('置顶成功！', {
	  							  icon: 1,
	  							  time: 2000 //2秒关闭（如果不配置，默认是3秒）
	  							}, function(){
	  								window.location.reload();
	  							});   
	  						} else {
	  							layer.alert("服务器繁忙，请稍候再试！");
	  						}
	  					}
	  				});
	  			});
	  		}
	  		
	  		function cacleIsTop(id) {
	  			var flag = 0;
	  			layer.confirm('确定取消置顶该条数据吗?', function(index){
	  				$.ajax({
	  					type : "post",
	  					url : "${base}/sys/noticeNews/cacleIsTop",
	  					data : {
	  						id : id
	  					},
	  					dataType : "json",
	  					async : false,
	  					success : function(data) {
	  						flag  = data.message;
	  						if(flag == 1) {
	  							layer.msg('取消置顶成功！', {
	  							  icon: 1,
	  							  time: 2000 //2秒关闭（如果不配置，默认是3秒）
	  							}, function(){
	  								window.location.reload();
	  							});   
	  						} else {
	  							layer.alert("服务器繁忙，请稍候再试！");
	  						}
	  					}
	  				});
	  			});
	  		}

</script>
</body>
</html>

